package com.zc.campus_shops.enums;

/**
 * 商品类别枚举类
 * 
 * @author 请叫我小纯洁丶
 *
 */
public enum ProductStateEnum {

	SUCCESS(1, "新增成功"), INNER_ERROR(-1001, "操作失败"), EMPTY_LIST(-1002, "商品为空");

	private int state;
	private String stateInfo;

	private ProductStateEnum(int state, String stateInfo) {
		this.state = state;
		this.stateInfo = stateInfo;
	}

	/**
	 * 根据传入的state返回相应的enum值
	 */

	public static ProductStateEnum stateOf(int index) {
		for (ProductStateEnum stateEnum : values()) {
			if (stateEnum.getState() == index) {

				return stateEnum;
			}
		}
		return null;
	}

	public int getState() {
		return state;
	}

	public String getStateInfo() {
		return stateInfo;
	}

}
